﻿using Elsa.Workflows;
using Elsa.Workflows.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ElsaWorkFlows.CustomerActivity
{
    public class HelloWorld : Activity
    {
        //protected override void Execute(ActivityExecutionContext context)
        //{
        //    base.Execute(context);
        //}

        /// <summary>
        /// 判断活动是否可以执行
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        protected override ValueTask<bool> CanExecuteAsync(ActivityExecutionContext context)
        {
            //return ValueTask.FromResult(true);
            return ValueTask.FromResult(false);
            //return base.CanExecuteAsync(context);
        }

        /// <summary>
        /// 活动中执行的具体逻辑
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        protected override ValueTask ExecuteAsync(ActivityExecutionContext context)
        {
            Console.WriteLine("hello world");
            return base.ExecuteAsync(context);
        }
    }
}